package top.rainbowecho.model.vo;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;
import top.rainbowecho.common.validate.MobilePhone;
import top.rainbowecho.common.validate.NotBlankString;
import top.rainbowecho.model.view.UserChangePwd;
import top.rainbowecho.model.view.UserRegister;

import javax.validation.constraints.Email;

/**
 * @author rainbow
 * @since 2020/3/2 11:24
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class UserRegisterVo {

    /**
     * 用户名，必选
     */
    @NotBlankString(message = "用户名不能为空", groups = {UserRegister.class, UserChangePwd.class})
    @Length(min = 2, max = 20, message = "用户名长度不符合", groups = {UserRegister.class, UserChangePwd.class})
    private String username;

    /**
     * 身份证号
     */
    @NotBlankString(message = "身份证号不能为空", groups = UserRegister.class)
    private String idCard;

    @Email(message = "邮箱格式不正确", groups = UserRegister.class)
    private String mail;

    @MobilePhone(groups = UserRegister.class)
    private String phone;

    /**
     * 加密后的密码，必选
     */
    @NotBlankString(message = "密码不能为空", groups = {UserRegister.class, UserChangePwd.class})
    private String password;


    @NotBlankString(message = "用户真实姓名不能为空", groups = UserRegister.class)
    @Length(min = 2, max = 10, message = "用户真实姓名长度不符合条件", groups = UserRegister.class)
    private String realName;

    @NotBlankString(message = "新密码不能为空", groups = {UserChangePwd.class})
    private String newPassword;

}
